package com.jboost.modules.app.util;

import com.google.common.collect.Maps;
import com.jboost.modules.app.constant.Strategy;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;

public class RefelctUtils {
    public static void copy(Object a,String methodA,Object b,String methodB) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Method method = a.getClass().getMethod("set" + methodB, Map.class);
        Method method1 = b.getClass().getMethod("get" + methodA);
        method.invoke(a, getParaMap(method1.invoke(b)));
    }

    static Map<String, Object> getParaMap(Object o) {
        Map map = Maps.newHashMap();
        map.put("value",o);
        return map;
    }
}
